/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.report.deposit;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.primefaces.context.RequestContext;
import org.primefaces.event.CloseEvent;
import src.Menu;
import src.MenuBean;
import src.report.ReportFilter;

/**
 *
 * @author Yusup Jauhari Shandi <in.visi>
 */
@ManagedBean
@SessionScoped
public class DepositReportBean implements Serializable{
    private List<Menu> availableMenu;
    private Menu SelectedReport;
    private ReportFilter reportFilter;
    private boolean showLookup=false;
    
    public DepositReportBean() {
        MenuBean menuBean = new MenuBean();
        Map<String,Object> filters = new HashMap<>();
        filters.put("menuType", "report");
        filters.put("menuGroup", "TERM_DEPOSIT");
        filters.put("hide", -1);
        reportFilter = new ReportFilter();
        availableMenu = menuBean.getMenuByType(filters);
        this.SelectedReport = new Menu(-1, null, null, null, null, null, null, Integer.SIZE, null);
    }

    public ReportFilter getReportFilter() {
        return reportFilter;
    }

    public void setReportFilter(ReportFilter reportFilter) {
        this.reportFilter = reportFilter;
    }

    public boolean isShowLookup() {
        return showLookup;
    }

    public void setShowLookup(boolean showLookup) {
        this.showLookup = showLookup;
    }

    
    public List<Menu> getAvailableMenu() {
        return availableMenu;
    }

    public Menu getSelectedReport() {
        return SelectedReport;
    }

    public void setSelectedReport(Menu SelectedReport) {
        this.SelectedReport = SelectedReport;
    }
    
    public void showDialog(String value) {
        value+=".show();";
        RequestContext.getCurrentInstance().execute(value);
    }
    
     public void handleCloseLookup(CloseEvent event) {
        this.showLookup=false;
    }
    
    public void executeReport(){
        Integer reportId = this.SelectedReport.getMenuId();
        switch (reportId) {
             //case 231 : new RptDaftarRekapMutasiBean().execute(reportFilter);break;
             //case 232 : new RptJadwalBayarBungaBean().execute(reportFilter);break;
             //case 233 : new RptBungaPajakBean().execute(reportFilter);break;
             //case 234 : new RptDepositoJatuhTempoBean().execute(reportFilter);break;
             case 235 : new RptNominatifDepositoBean().execute(reportFilter);break;
             case 236 : new RptPembukaanRekDepositoBean().execute(reportFilter);break;
             //case 237 : new RptTransaksiDepositoBean().execute(reportFilter);break;
        }
    }
    
    
}
